import React, { Component } from 'react';
import Comp1 from './Com1';
import Comp2 from './Com2'

class People extends Component {
  state = {
    condition: false,
    list: [{
      id: 1,
      name: 'hanye',
      age: 20
    }, {
      id: 2,
      name: "周光磊",
      age: 18
    }]
  }
  render() {
    return (
      <>
        {
          this.state.condition ? <Comp1/> : <Comp2/>
        }
        <ul>
          {
            this.state.list.map((person) => {
              return <li key={person.id}>name:{person.name}-age:{person.age}</li>
            })
          }
        </ul>
      </>
    );
  }
}

export default People;